package cn.memorynine.consumer.controller;

import cn.memorynine.common.model.ResponseWrapper;
import cn.memorynine.consumer.model.consumer.login.ImageCodeParam;
import cn.memorynine.consumer.model.consumer.login.LoginParam;
import cn.memorynine.consumer.model.consumer.login.NeedImageCodeParam;
import cn.memorynine.consumer.model.consumer.logup.IsAccountExistParam;
import cn.memorynine.consumer.model.consumer.logup.LogupParam;
import cn.memorynine.consumer.service.ConsumerLoginService;
import cn.memorynine.consumer.service.ConsumerLogupService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;

@Slf4j
@RestController
@RequestMapping("/consumerLogup")
public class ConsumerLogupController {

    @Autowired
    private ConsumerLogupService consumerLogupService;

    /**
     * 1.用户注册
     */
    @RequestMapping("/logup")
    public ResponseWrapper logup(@RequestBody @Validated LogupParam param){
        return consumerLogupService.logup(param);
    }

    /**
     * 2.查看当前手机号/邮箱是否被注册
     */
    @RequestMapping("/isAccountExist")
    public ResponseWrapper isAccountExist(@RequestBody @Validated IsAccountExistParam param){
        return consumerLogupService.isAccountExist(param);
    }

}
